/* Copyright (c) 2004-2024 Peigen.info. All rights reserved. */

package info.peigen.hotpot.component.feedback.repository.mapper;

import info.peigen.hotpot.component.data.repository.beetlsql.mapper.AbstractBeetlSqlMapper;
import info.peigen.hotpot.component.feedback.repository.entity.FeedbackEntity;
import info.peigen.hotpot.component.feedback.service.enums.FeedbackType;
import org.beetl.sql.mapper.annotation.Select;
import org.beetl.sql.mapper.annotation.Sql;
import org.beetl.sql.mapper.annotation.Update;

import java.util.List;

/**
 * <b>(FeedbackMapper)</b>
 *
 * @author Peigen
 * @version 1.0.0
 * @since 2021/8/12
 */
@SuppressWarnings("AlibabaAbstractMethodOrInterfaceMethodMustUseJavadoc")
public interface FeedbackMapper extends AbstractBeetlSqlMapper<FeedbackEntity> {
    @Sql("select * from feedback where customer_id = ?")
    @Select
    List<FeedbackEntity> findByCustomerId(String customerId);

    @Sql("select * from feedback where type = ?")
    @Select
    List<FeedbackEntity> findByType(FeedbackType type);

    @Sql("delete from feedback where customer_id = ?")
    @Update
    void deleteByCustomerId(String customerId);

    @Sql("delete from feedback where type = ?")
    @Update
    void deleteByType(FeedbackType type);
}